<script setup lang="ts">
  import { cn } from '@renderer/lib/utils'
  import {
    NavigationMenuIndicator,
    type NavigationMenuIndicatorProps,
    useForwardProps
  } from 'reka-ui'
  import { computed, type HTMLAttributes } from 'vue'

  const props = defineProps<NavigationMenuIndicatorProps & { class?: HTMLAttributes['class'] }>()

  const delegatedProps = computed(() => {
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    const { class: _, ...delegated } = props

    return delegated
  })

  const forwardedProps = useForwardProps(delegatedProps)
</script>

<template>
  <NavigationMenuIndicator
    data-slot="navigation-menu-indicator"
    v-bind="forwardedProps"
    :class="
      cn(
        'data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden',
        props.class
      )
    "
  >
    <div class="rounded-tl-sm bg-border h-2 w-2 shadow-md rotate-45 top-[60%] relative" />
  </NavigationMenuIndicator>
</template>
